<template>
  <el-row class="tables">
    <!-- 表格 头部 -->
    <el-row class="tableTh">
      <el-col :span="2">
        <span>原料类型</span>
      </el-col>
      <el-col :span="3">
        <span>物料名称</span>
      </el-col>
      <el-col :span="3">
        <span>物料编码</span>
      </el-col>
      <el-col :span="2">
        <span>品牌型号</span>
      </el-col>
      <el-col :span="3">
        <span>出库日期</span>
      </el-col>
      <el-col :span="2">
        <span>数量</span>
      </el-col>
      <el-col :span="2">
        <span>操作类型</span>
      </el-col>
      <el-col :span="2">
        <span>单位</span>
      </el-col>
      <el-col :span="2">
        <span>出库人</span>
      </el-col>
      <el-col :span="3">
        <span>库位</span>
      </el-col>
    </el-row>
    <!-- 表格行 -->
    <div v-if="tableData.length > 0" class="showDiv">
      <el-row
        v-for="(item, index) in tableData"
        :class="{ 'row-striped': index % 2 === 1 }"
        :key="item.id"
        class="tableTd"
      >
        <el-col :span="2">
          <span>{{ item.classifyName }}</span>
        </el-col>
        <el-col :span="3">
          <span>{{ item.materialName }}</span>
        </el-col>
        <el-col :span="3">
          <span>{{ item.materialCode }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.model }}</span>
        </el-col>
        <el-col :span="3">
          <span>{{ item.outDate }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.outNum }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.type }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.unit }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.userName }}</span>
        </el-col>
        <el-col :span="3">
          <span>{{ item.wmsName }}</span>
        </el-col>
      </el-row>
    </div>
    <div v-else class="kong">暂无数据</div>
  </el-row>
</template>
<script>
export default {
  props: {
    tableData: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {};
  },
  watch: {},
  mounted() {},
  methods: {},
};
</script>
<style lang="scss" scoped>
.row-striped {
  background-color: #305483; /* 背景色可以根据需要自定义 */
}
.tables {
  height: 100%;
  color: #fff;
  .showDiv {
    height: 85%;
  }
  .tableTh,
  .tableTd {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    .el-col {
      text-overflow: ellipsis; /*让截断的文字显示为点点。还有一个值是clip意截断不显示点点*/
      white-space: nowrap; /*让文字不换行*/
      overflow: hidden; /*超出要隐藏*/
    }
  }
  .tableTh {
    width: 100%;
    height: 15%;
    // font-weight: bold;
    font-size: 12px;
    background: #396ba2;
  }
  .tableTd {
    height: 14.2857%;
    font-size: 12px;
    // font-weight: bold;
  }
  .kong {
    height: calc(100% - 30px);
    background-size: 30% auto;
  }
}
</style>
